#!/bin/bash

BB_PATH="/projects/My-Blog"
echo ${BB_PATH}
cd ..
echo "拉去最新代码"
git pull
echo "删除之前的jar包"
rm ${BB_PATH}/my-blog.jar
echo "mvn 打包"
mvn -U clean package -Dmaven.test.skip=true
echo "获得打包好的jar包"
cp ${BB_PATH}/target/my-blog-1.0.jar ${BB_PATH}/my-blog.jar
echo "删除、停止容器"
docker rm myblog -f
echo "删除镜像"
docker rmi chosen/my-blog:v1
echo "根据Dockerfile打包成镜像"
docker build -t chosen/my-blog:v1 .
echo "启动容器"
docker run --name myblog -d -p 8080:28083 chosen/my-blog:v1
